//
//  ImageCell.m
//  RoadLine
//
//  Created by dllo on 15/5/2.
//  Copyright (c) 2015年 RedFireNoodles. All rights reserved.
//

#import "ImageCell.h"
#import "NightManager.h"

// 定义宏
#define WIDTH self.contentView.frame.size.width
#define HEIGHT self.contentView.frame.size.height

@implementation ImageCell

-(instancetype)initWithFrame:(CGRect)frame{
    self = [super initWithFrame:frame];
    
    if (self) {
//        CGFloat width = [[UIScreen mainScreen] bounds].size.width;
        CGFloat height = [[UIScreen mainScreen] bounds].size.height;
        
        self.myImageView = [[UIImageView alloc] initWithFrame:CGRectMake(0, 64, WIDTH, HEIGHT)];
        [self.contentView addSubview:self.myImageView];
        [_myImageView release];
        
        CGFloat bili = self.myImageView.frame.size.height / self.myImageView.frame.size.width;
        if (self.myImageView.frame.size.width >= WIDTH) {
            self.myImageView.frame = CGRectMake(0, 20, WIDTH, WIDTH * bili);
            
        }
//        UIView *bgView = [[UIView alloc] initWithFrame:CGRectMake(0, WIDTH - WIDTH/4, WIDTH, WIDTH/4)];
//        [self.view addSubview:bgView];
//        [bgView release];
//        bgView.backgroundColor = [UIColor clearColor];
        
//        UIImageView *myImageView = [[UIImageView alloc] initWithFrame:CGRectMake(0, 0, WIDTH, HEIGHT)];
//        myImageView.backgroundColor = [UIColor clearColor];
//        [self.view addSubview:myImageView];
//        myImageView.center = CGPointMake(WIDTH/2, HEIGHT/3 + 64);
        

        
        // 控制文字显示用
//        UIView *viewPlace = [[UIView alloc] initWithFrame:CGRectMake(WIDTH, HEIGHT - 100, WIDTH, 100)];
//        [self.contentView addSubview:viewPlace];
//        viewPlace.backgroundColor = [UIColor clearColor];
//        [self.view bringSubviewToFront:viewPlace];

//        // 显示图片简介
        self.label = [[UILabel alloc] initWithFrame:CGRectMake(20, height - 90 - 64, WIDTH - 40, 90)];
        self.label.numberOfLines = 4;
        self.label.font = [UIFont systemFontOfSize:14];
        self.label.backgroundColor = self.contentView.backgroundColor;
        [self.contentView addSubview:self.label];
//        [viewPlace bringSubviewToFront:label];
        self.label.textColor = [UIColor blackColor];
//
//        // 显示图片拍摄地址 时间
//        UILabel *labelPlace = [[UILabel alloc] initWithFrame:CGRectMake(20, 70, WIDTH - 40, 30)];
//        labelPlace.font = [UIFont systemFontOfSize:10];
//        labelPlace.textColor = [UIColor whiteColor];
//        [self.view bringSubviewToFront:self.labelPlace];
        
        self.contentView.backgroundColor = [UIColor colorWithRed:250/255.0 green:245/255.0 blue:232/255.0 alpha:1];
        
        if ([Singleton shareSingleton].isNight) {
            [[Singleton shareSingleton] loadNightModeInfoFormDisk];
        }
        
    }
    return self;
    
}

- (void)setLightDayModel {
    
    self.contentView.backgroundColor = [UIColor colorWithRed:250/255.0 green:245/255.0 blue:232/255.0 alpha:1];
//    self.myLabel.textColor = [UIColor blackColor];
//    [NightManager setBackgroundColorWithView:self.view];
    
}

- (void)setNightDayModel {
    self.contentView.backgroundColor = [UIColor blackColor];
//    self.myLabel.textColor = [UIColor blackColor];
//    [NightManager setBackgroundColorWithView:self.view];
}



@end
